#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <sstream>

using namespace std;

int Reverse(int);
string ConvertIntToString(int);

int main (int argc, char** argv)
{
	int t;
	
	scanf("%d", &t);
	
	for(int i = 0; i < t; i++)
	{
		int num1 , num2;
	
		scanf("%d %d", &num1 , &num2);
		
		int result = Reverse(num1) + Reverse(num2);
		
		printf("%d\n",Reverse(result));
	}
	
	return 0;
}

int Reverse(int num)
{
	string numStr = ConvertIntToString(num);

	string numStrRev;
	
	for (int i = numStr.size() - 1; i >= 0; --i)
	{
		numStrRev.push_back(numStr[i]);
	}

	return atoi(numStrRev.c_str());
}

string ConvertIntToString(int number)
{
   stringstream ss;
   ss << number;
   return ss.str();
}